import math

rev = []
coss = []
sinn = []

def fft(length: int, a, o: int) -> None:
    '''
    FFT Function, make the array A change the place
    return: None
    '''
    for i in range(length + 1):
        if i < rev[i]: 
            a[i], a[rev[i]] = a[rev[i]], a[i]
    j = 1
    while j < length:
        wn = complex(coss[j], o * sinn[j])
        for k in range(0, length, j << 1):
            w0 = complex(1.0, 0.0)
            for i in range(0, j):
                X = a[i + k]
                Y = w0 * a[i + j + k]
                a[i + k] = X + Y
                a[i + k + j] = X - Y
                w0 = w0 * wn
            k += (j << 1)
        j <<= 1 

def fft_main(l1, l2):
    '''
    FFT Main, process the sequence to float num and calc \sum_{1 <= i <= n, 1 <= j <= n + m} {seq1(i) * seq2(i + k)} 
    return: Calcuation
    '''
    len1 = len(l1)
    len2 = len(l2)
    global length
    length = 1
    l = 0
    while(length <= len1 + len2):
        length <<= 1
        l += 1
    # Add 0
    for i in range(len1, length + 1): l1.append(0)
    for i in range(len2, length + 1): l2.append(0)
    # Change to imag data
    cpx = []
    for kssn in range(length + 1): cpx.append(complex(l1[kssn], l2[kssn]))
    rev.append(0)
    for i in range(1, length + 1):
        rev.append(((rev[i >> 1] >> 1) | ((i & 1) << (l - 1))))
    for kssn in range(0, length + 1):
        coss.append(0.0)
        sinn.append(0.0)
    i = 1
    while i <= length:
        coss[i] = math.cos(math.pi / i)
        sinn[i] = math.sin(math.pi / i)
        i <<= 1
    ##### Polygon multiply polygon
    fft(length, cpx, 1) # DFT
    for i in range(length + 1): cpx[i] = cpx[i] * cpx[i]
    fft(length, cpx, -1) # IDFT
    return cpx[0 : (len1 + len2 - 1)]

if __name__ == '__main__':
    global n, m
    n, m = map(int, input().split())
    p1 = list(map(int, input().split()))
    p2 = list(map(int, input().split()))
    ans = fft_main(p1, p2)
    for i in ans: print(int(i.imag / length / 2 + 0.49), end = ' ')
    print('\n')